<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2017 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 老猫 <thinkcmf@126.com>
// +----------------------------------------------------------------------
namespace app\portal\api;

use app\portal\service\PostService;

class ArticleApi
{
    /**
     * 幻灯片列表 用于模板设计
     * @param array $param
     * @return false|\PDOStatement|string|\think\Collection
     */
    public function index($param = [])
    {
        $postService        = new PostService();
        $param['page_size'] = 10000;

        $data               = $postService->adminArticleList($param)->toArray();
        $articles           = $data['data'];
        // $data;
        foreach ($articles as $k => &$v) {
            $v['name'] = $v['post_title'];
        }
        // pre($articles,1);
        //返回的数据必须是数据集或数组,item里必须包括id,name,如果想表示层级关系请加上 parent_id
        return $articles;
    }

}
